<template>
  <div class="breadcrumb">
    <el-breadcrumb separator-icon="ArrowRight">
      <template v-for="item in breadCrumbs" :key="item.name">
        <el-breadcrumb-item :to="item.path">
          {{ item.name }}
        </el-breadcrumb-item>
      </template>
    </el-breadcrumb>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { useLoginStore } from '@/store/login/login'
import { mapMenuToBread } from '@/utils/mapMnent'
import { useRoute } from 'vue-router'

const route = useRoute()
const userMenu = useLoginStore().userMenuTree
const breadCrumbs = computed(() => {
  return mapMenuToBread(route.path, userMenu)
})
</script>

<style lang="scss" scoped>
.breadcrumb {
  display: flex;
}
</style>
